package org.third.integration.db.flyway;

//import com.googlecode.flyway.core.Flyway;

import org.apache.commons.dbcp2.BasicDataSource;
import org.flywaydb.core.Flyway;

public class FlywayTest {
    
    public static void main(String[] args) {
        BasicDataSource dbcp2  =new BasicDataSource();
//        dbcp2.setUrl("jdbc:sqlserver://15.119.81.210:1433;databaseName=idm_gongyo3");
//        dbcp2.setUsername("sa"); 
//        dbcp2.setPassword("1qazxsw2"); 
//        dbcp2.setDriver(new com.microsoft.sqlserver.jdbc.SQLServerDriver());
        
        //jdbc:jtds:sqlserver://MYPC:1433/Blog;instance=SQLEXPRESS;user=sa;password=s3cr3t
        //jdbc:jtds:sybase://15.119.81.210:1433/idm_gongyo3");
        dbcp2.setUrl("jdbc:jtds:sqlserver://15.119.81.210:1433/idm_gongyo3");
        dbcp2.setUsername("sa"); 
        dbcp2.setPassword("1qazxsw2"); 
        dbcp2.setDriver(new net.sourceforge.jtds.jdbc.Driver());
        dbcp2.setValidationQuery("select 1"); //DBCP throws error without this query
        
//        dbcp2.setUrl("jdbc:postgresql://16.187.188.62/idm_gongyo_test");
//        dbcp2.setUsername("postgres");
//        dbcp2.setPassword("postgres");
//        dbcp2.setDriver(new org.postgresql.Driver());
        Flyway f = new Flyway();
//        f.setInitOnMigratje(false);
//        f.setDataSource("jdbc:postgresql://16.187.188.62/idm_flyway", "postgres","postgres");
//        f.setLocations("org.third.db.flyway.postgres");        
        f.setDataSource( dbcp2);
        f.setLocations("org.third.db.flyway.sqlserver");
//        f.setLocations("postgresql.db.migration");
        
        f.migrate();
    }
}
